package com.authority.framework.config.interceptor;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;
/** 
* @Description: 登录拦截器 
* @Param:  
* @return:  
* @Author: Mr.Yan 
* @Date: 2018/12/11 
*/

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
    /**
     * 登录session key
     */
    public static final String SESSION_KEY = "user";

    @Bean
    public SecurityInterceptor getSecurityInterceptor() {
        return new SecurityInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration addInterceptor = registry.addInterceptor(getSecurityInterceptor());

        // 排除配置
        addInterceptor.excludePathPatterns("/login");
        addInterceptor.excludePathPatterns("/**/**.js","/**/**.css","/**/**.ico","/**/**.jpg","/**/**.png");
        addInterceptor.excludePathPatterns("/layui2.4/**","/common/**","/web/**");
        addInterceptor.excludePathPatterns("/unRegister");
        // 拦截配置
        addInterceptor.addPathPatterns("/**");
    }
}
